package com.briup.smartlabs.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;

import com.briup.smartlabs.bean.SmartLabs;
import com.briup.smartlabs.common.exceptions.DataValidateException;
import com.briup.smartlabs.mapper.SmartLabsMapper;
import com.briup.smartlabs.mapper.ex.DeviceMapper;
import com.briup.smartlabs.mapper.ex.SmartLabsExMapper;
import com.briup.smartlabs.service.LabsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
public class LabsServiceImpl implements LabsService {
	@Autowired
	private SmartLabsMapper labsMapper;
	
	@Autowired
	private SmartLabsExMapper labsExMapper;
	
	@Autowired
	private DeviceMapper deviceMapper;
	
	@Override
	public void saveOrUpdate(SmartLabs labs) {
		System.out.println("in saveOrUpdate ...");

		//判断实验室标识是否存在

		//判断网络地址是否被占用

		//save or update

	}

	@Override
	public Map<String, List<String>> removeByBatch(List<String> ids) {
		/**
		 *  返回结果：
		 *  	success： 在数据库中存在，并且成功删除的
		 *  	error:	 在数据库中不存在的，
		 * 业务：
		 * 	存在在数据库中的实验室，判断其是否有关联的设备，如果解除有关联。
		 */
		System.out.println("in removeByBatch ...");

		List<String> existIds = null;
		List<String> errorIds = null;

		//解绑实验室设备

		//删除实验室

		Map<String, List<String>> result = 
				new HashMap<>();
		result.put("success", existIds);
		result.put("error", errorIds);
		return result;
	}

	@Override
	public PageInfo<SmartLabs> findByCondition(int pageNum, int pageSize, String key) {
		System.out.println("in findByCondition");

		return null;
	}

}




